package thunderbirdgtd.entities;

import java.awt.Color;

public class Priority {
	private int level;
	private String name;
	private Color color;



	private static Priority highPriority;
	private static Priority mediumPriority;
	private static Priority lowPriority;

	public Priority(int level, String name, Color color) throws Exception {

		this.name = name;
		this.level = level;
		this.color = color;
		if (color == null)
			throw new Exception("Color not defined");
	}

	public static Priority getHighPriorityInstance() throws Exception {
		if (highPriority == null) {
			highPriority = new Priority(1, "High priority",
					new Color(255, 0, 0));
		}
		return highPriority;
	}

	public static Priority getMediumPriorityInstance() throws Exception {
		if (mediumPriority == null) {
			mediumPriority = new Priority(2, "Medium priority", new Color(0,
					255, 0));
		}
		return mediumPriority;
	}

	public static Priority getLowPriorityInstance() throws Exception {
		if (lowPriority == null) {
			lowPriority = new Priority(3, "Low priority", new Color(0, 0, 255));
		}
		return lowPriority;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}

	public String toString() {

		return "Color: " + getColor().toString() + " Level: " + getLevel()
				+ " Name: " + getName();
	}
}
